<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2016/12/15
 * Time: 10:51
 */

//Find the position of the first occurrence of a substring in a string
//返回在字符串 haystack 中 needle 首次出现的数字位置。
//如果没找到 needle，将返回 FALSE。


echo (strpos("zr zrx zrxzr","zrx")).PHP_EOL;
echo gettype(strpos("zr zrx zrxzr","zrx")).PHP_EOL;
if(strpos("zrx zrx zrxzr","zrx") === 0 ){
	echo "first".PHP_EOL;
}
$alias="@frontend";
$alias="@frontend/test";
$pos = strpos($alias, '/');

//echo substr($alias, 0, $pos).PHP_EOL;

$root = $pos === false ? $alias : substr($alias, 0, $pos);
echo gettype($pos).PHP_EOL;
echo ($root.PHP_EOL);
$path = dirname(dirname(__DIR__)) . '/frontend';
$path = strncmp("@".$path, '@', 1) ? rtrim($path, '\\/') :"$path";
echo $path.PHP_EOL;




